import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import QStringListModel

#显示二维表格
class myQlistview(QWidget):
    def __init__(self):
        super().__init__()

        self.setWindowTitle("有时候我觉得自己像一只小小鸟")
        self.resize(500,300)

        listview=QListView()
        listModel=QStringListModel()
        self.list=["列表1","列表2","列表3"]

        listModel.setStringList(self.list)
        listview.setModel(listModel)

        listview.clicked.connect(self.clicked)

        layout=QVBoxLayout()
        layout.addWidget(listview)
        self.setLayout(layout)

    def clicked(self,item):
        QMessageBox.information(self,"我觉得","你是"+self.list[item.row()])


if __name__ == '__main__':
    app=QApplication(sys.argv)
    myc=myQlistview()
    myc.show()
    sys.exit(app.exec_())